// ***********************************************************************
// Assembly         : GeYiHome.OpenApi
// Author           : wzx
// Created          : 03-29-2017
//
// Last Modified By : wzx
// Last Modified On : 03-29-2017
// ***********************************************************************
// <copyright file="ConsultController.cs" company="Nl">
//     版权所有(C)  2017
// </copyright>
// <summary></summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GeYiHome.Bussines.BusinesService;
using GeYiHome.Dto.Request;
using GeYiHome.Dto.Response;
using GeYiHome.PublicLibrary;

namespace GeYiHome.OpenApi.Controllers
{
    /// <summary>
    /// Class ConsultController.
    /// </summary>
    /// <seealso cref="GeYiHome.OpenApi.Controllers.NlController" />
    public class ConsultController : NlController
    {
        /// <summary>
        /// The _service
        /// </summary>
        private readonly CustomService _service;

        public ConsultController()
        {
            _service = new CustomService(); 
        }
        public JsonResult AddCustom(DtoCustomRequest custom)
        {

            var result = _service.AddCustom(custom);
            return Ok(result);
        }

        public JsonResult ModifyCustomByLamda(DtoCustomModifyRequest custom)
        {
            var result = _service.ModifyCustomByLamda(custom);
            return Ok(result);
        }

        public JsonResult ModifyCustomByModel(DtoCustomModifyRequest custom)
        {
            var result = _service.ModifyCustomByModel(custom);
            return Ok(result);
        }

        public JsonResult DeleteByModel(Guid id)
        {
            var result = _service.DeleteByModel(id);
            return Ok(result);
        }

        public JsonResult DeleteBySpecification(int minAge, int maxAge)
        {
            var result = _service.DeleteBySpecification(minAge, maxAge);
            return Ok(result);
        }

        public JsonResult DeleteById(Guid id)
        {
            var result = _service.DeleteById(id);
            return Ok(result);
        }

        public JsonResult GetCustomById(Guid id)
        {
            var result = _service.GetCustomById(id);
            return Ok(result);
        }

        public JsonResult GetList(string name, DateTime? dateTime = null)
        {
            var result = _service.GetList(name, dateTime);
            return Ok(result);
        }

        public JsonResult GetPageList(int pageIndex, int pageSize, string name, DateTime? dateTime)
        {
            var result = _service.GetPageList(pageIndex, pageSize, name, dateTime);
            return Ok(result);
        }
    }
}